package com.piece.core.framework.util.schedule;

import lombok.Data;

@Data
public class ScheduleJob {

    /**
     * schedule标识
     */
    private String key;

    /**
     * 任务名称
     */
    private String name;

    /**
     * 参数对象
     */
    private String param;

    /**
     * 时间表达式
     */
    private String cron;

    /**
     * 定时器状态
     * 0完成 1删除 2执行中 3暂停 4错误
     */
    private String status;

    /**
     * 执行任务调用类
     */
    private Object target;

    /**
     * 执行任务调用方法
     */
    private String method;

    /**
     * cron计划策略
     */
    private String misfirePolicy;

    /**
     * 重试次数
     */
    private Integer retryCount = 0;

    /**
     * 重试间隔
     */
    private Integer retryInterval = 0;

    /**
     * 记录日志ID
     */
    private String logId;

    public ScheduleJob(String key, String name, String cron, String misfirePolicy) {
        this.key = key;
        this.name = name;
        this.cron = cron;
        this.misfirePolicy = misfirePolicy;
    }

    public ScheduleJob(String key, String name, String cron, String misfirePolicy, String param) {
        this.key = key;
        this.name = name;
        this.cron = cron;
        this.misfirePolicy = misfirePolicy;
        this.param = param;
    }
}